<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="./lib/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<a href="#" @click.prevent="myName='mycom1'">登录</a>
			<a href="#" @click.prevent="myName='mycom2'">注册</a>
			<!-- component是一个占位符，：is属性，可以用来指定要展示的组件的名称 -->
			<!-- 因为组件名称是字符串，所以要加'' -->
			<!-- <component :is="'mycom1'"></component> -->
			<!-- myName是调用实列 -->
			<component :is="myName"></component>
		</div>
		<template id="tmp1">
			<div>
				<h3>登录组件</h3>
			</div>
		</template>
		<template id="tmp2">
			<div>
				<h3>注册组件</h3>
			</div>
		</template>
		<script>
			Vue.component('mycom1', {
				template: '#tmp1'
			})
			Vue.component('mycom2', {
				template: '#tmp2'
			})
			var vm = new Vue({
				el: '#app',
				data: {
					myName:'mycom1'
				},
				methods: {}
			})
		</script>
	</body>
</html>
